﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.Samples.ServiceHosting.StorageClient;
namespace Inscription_WebRole
{
    public class InscriptionConf
    {

        private static StorageAccountInfo _account;
        private static TableStorage _tableStorage;

        private const int NumRetries = 3;
       
        public static void Initialize()
        {
            
            try
            {
                _account = StorageAccountInfo.GetDefaultTableStorageAccountFromConfiguration();
                _tableStorage = TableStorage.Create(_account);

                _tableStorage.TryCreateTable("InscriptionTable");
            }
            catch (Exception e)
            {
                //throw new Exception("Could not create or find album table in the data service ", e);
            }
        }
    }


    public class Inscription : TableStorageEntity
    {
        public Inscription(string partitionKey, string rowKey)
            : base(partitionKey, rowKey)
        {
            // We set a default value for the date time field because the table
            // storage service rejects date times not in the correct range.
            C = TableStorageConstants.MinSupportedDateTime;
        }

        public Inscription(string partitionKey, string rowKey, string _firstname, string _lastname, string _email, string _interest, string _suscribtion)
            : base(partitionKey, rowKey)
        {
            C = TableStorageConstants.MinSupportedDateTime;
            firstName = _firstname;
            lastName = _lastname;
            email = _email;
            interest = _interest;
            subscription = _suscribtion;
        }

        public Inscription(): base()
        {
        }

        public string firstName
        {
            get;
            set;
        }

        public string lastName
        {
            get;
            set;
        }

        public string email
        {
            get;
            set;
        }

        public string subscription
        {
            get;
            set;
        }

        public string interest
        {
            get;
            set;
        }

        public DateTime C
        {
            get;
            set;
        }
    }
}
